package main

import (
	"algorithm/ArrayList"
	"fmt"
)

func main1() {

	al := ArrayList.NewArrayList()
	al.Append("a1")
	al.Append("b1")
	al.Append("c1")

	for i := 0; i < 10; i++ {
		al.Insert(2, "d1")
	}

	al.Delete(1)

	fmt.Println(al)
}

func main() {

	al := ArrayList.NewArrayList()
	al.Append("a1")
	al.Append("b1")
	al.Append("c1")

	for i := 0; i < 10; i++ {
		al.Append("d1")
	}

	fmt.Println(al.TheSize)

	//al.Delete(1)

	fmt.Println(al)
}

func main5() {

	//al := ArrayList.NewArrayList()
	var al ArrayList.List = ArrayList.NewArrayList()
	al.Append("a1")
	al.Append("b1")
	al.Append("c1")
	al.Append("d1")
	al.Append("e1")
	al.Append("f1")
	al.Append("g1")
	al.Append("h1")
	al.Append("k1")

	// fmt.Println(al)
	fmt.Println(al)
	for it := al.Iterator(); it.HasNext(); {
		val, err := it.Next("a123456")
		if err == nil {
			if val == "c1" {
				fmt.Println(it.GetIndex())
				it.Remove()
			}
		} else {
			fmt.Println(err)
		}
	}

	fmt.Println(al)
}
